package com.jn.exam.ucenter.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jn.exam.ucenter.entity.Student;
import com.jn.exam.ucenter.mapper.StudentMapper;
import com.jn.exam.ucenter.service.StudentService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.AsyncResult;
import org.springframework.stereotype.Service;

import java.util.concurrent.Future;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 江南大学1033190417
 * @since 2022-01-13
 */
@Service
public class StudentServiceImpl extends ServiceImpl<StudentMapper, Student> implements StudentService {

    @Override
    public Student loginByNumber(String number, String password) {
        QueryWrapper<Student> wrapper=new QueryWrapper<>();
        wrapper.eq("number",number);
        wrapper.eq("password",password);
        Student student = baseMapper.selectOne(wrapper);
        return student;
    }

    @Override
    public Student loginByPhone(String phone) {
        QueryWrapper<Student> wrapper=new QueryWrapper<>();
        wrapper.eq("phone",phone);
        Student student = baseMapper.selectOne(wrapper);
        return student;
    }

    @Override
    public boolean deleteById(String studentId) {
        return baseMapper.removeById(studentId);
    }
}
